#! /usr/bin/env python
#coding=utf-8


import rospy
import tf2_ros
import tf
from geometry_msgs.msg import TransformStamped




if __name__ =="__main__":

    rospy.init_node("static_tf_p")
    # 创建静态坐标广播器
    broadcaster = tf2_ros.StaticTransformBroadcaster()
    # 创建并组织被广播的消息
    tfs = TransformStamped()


    # 头信息
    tfs.header.frame_id = "world"
    tfs.header.stamp = rospy.Time.now()
    tfs.header.seq = 101

    tfs.child_frame_id = "radar"

    tfs.transform.translation.x = 0.2
    tfs.transform.translation.y = 0.0
    tfs.transform.translation.z = 0.0


    #四元数

    qtn = tf.transformations.quaternion_from_euler(0,0,0)

    tfs.transform.rotation.x = qtn[0]
    tfs.transform.rotation.y = qtn[1]
    tfs.transform.rotation.z = qtn[2]
    tfs.transform.rotation.w = qtn[3]


    broadcaster.sendTransform(tfs)

    rospy.spin()